package edu.nuc.test1;

import java.util.Date;
import java.util.Calendar;

public class text {
    public static void main(String[] args) {


        Date date1 = new Date();      //取得当天日期
        System.out.print(date1 + "\n");


        Calendar c = Calendar.getInstance();
		/*你无法取得Calendar的实例（因为Canlendar是抽象的）,
即无法像new Date()一样创建一个日期的具体实例,
但是你可以取得他具体子类的实例（某种继承过Canlendar的子类）*/
        c.set(2021, 11, 4, 2, 15);        //设置日期
        System.out.print(c.getTime() + "\n");
        System.out.print(c.getTimeInMillis() + "\n");  //将当前日期以微秒形式输出

        long day1 = c.getTimeInMillis();
        c.add(c.HOUR_OF_DAY, 11);   //加上十一天（日期中day+11）
        System.out.print(c.getTime() + "\n");
        c.set(c.HOUR_OF_DAY, 11);   //设置日期中Day为11
        System.out.print(c.getTime() + "\n");

    }
}